<%@ page isELIgnored="false" %>
<%@page import="java.util.Random"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<base href="/shopping/views/">
<head>
	<title>注册</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	
	<link href="front/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<link href="front/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
	<link href="front/css/templatemo_style.css" rel="stylesheet" type="text/css">	
</head>
<body style="background:rgba(0,0,0,.5);">
    
    
    <div class="modal" id="mymodal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title">模态弹出窗标题</h4>
                </div>
                <div class="modal-body">
                    <p>模态弹出窗主体内容</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary">保存</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    
    
	<div class="container" style="position:relative;top:10px;">
		<div class="col-md-12">			
			<form class="form-horizontal templatemo-create-account templatemo-container"  action="" method="post">
                <div class="form-group">
                  <div class="col-md-6">	       	
                    <label for="username" class="control-label">姓名</label>
                    <input type="text" class="form-control" name="uname" id="username" placeholder="" onBlur="checkUserName()">		         		            		  
                      <span id="userName_warn"></span>     
                  </div>
                  <div class="col-md-6 templatemo-radio-group">
                    <label class="radio-inline">
                        <input type="radio"  name="usex" id="optionsRadios1" value="1">男
                    </label>
                    <label class="radio-inline">
                        <input type="radio"  name="usex" id="optionsRadios2" value="2">女
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="usex" id="optionsRadios2" value="3"> 不公开
                    </label>
                  </div>             
                </div>
                <div class="form-group">	
	                <div class="col-md-6">	       	
	                    <label for="username" class="control-label">账号</label>
	                    <input type="text" class="form-control" name="uaccount" id="uaccount" placeholder="" onBlur="checkUaccount()">		         		            		  
	                      <span id="userName_warn"></span>     
	                </div>
	            </div>
                <!--<div class="form-inner">
                <div class="form-group">
                  <div class="col-md-6">		          	
                    <label for="first_name" class="control-label">邮箱</label>
                    <input type="text" class="form-control" name="Uemail" id="first_name" placeholder="请输入您的邮箱" onBlur="checkEmail()"/> 
                     <span id="first_name_warn"></span> 
                     <input type="button" style="border:ridge 2px #CCCCCC" onClick="YZcodee()" id="YZcode" value="点击发送验证码"/>   
                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text"  placeholder="请输入验证码" name="YZcodeInput" id="YZcodeInput"/>
                   <span style="color: red;margin-left: 150px">${YZcodeErr }</span>
                  </div> 	        
                </div>-->

                <div class="form-group">	
                    <div class="col-md-6">	          	
                        <label for="last_name" class="control-label">手机</label>
                        <input style="width:300px" type="text" name="tel" class="form-control" id="last_name" placeholder="请输入您的手机" onBlur="checkPhone()">	
                         <span id="phone_warn"></span>  
                    </div>            		            		            
                  </div>  	

                <div class="form-group">
                  <div class="col-md-6">
                    <label for="password" class="control-label">密码</label>
                    <input type="password" class="form-control" name="upwd" id="password" placeholder="" onBlur="checkPassword()" required="required">
                     <span id="password_warn"></span>  
                  </div>
                </div>

                <div class="form-group">
                  <div class="col-md-6">
                    <label for="password" class="control-label">确认密码</label>
                    <input type="password" class="form-control" id="password_confirm" placeholder="" onBlur="checkPasswordagain()">
                     <span id="password_confirm_warn"></span>
                  </div>
                </div>

                <div class="form-group">
                  <div class="col-md-12">
                    <label><input type="checkbox" id="btnbtn-info" >同意以下协议<a href="javascript:void(0);" data-toggle="modal" data-target="#templatemo_modal">使用协议</a></label>
                  </div>
                </div>
                <div class="form-group">
                  <div class="col-md-12">
                    <input type="button" value="创建帐户" class="btn btn-info" id="registerUser" onClick="register()">
                    <input type="button" value="取消" class="btn btn-danger" id="cancalRegister" onClick="javascript:window.parent.close_div('registerDIV')" >
                    <a href="javascript:void(0)" class="pull-right" onClick="javascript:window.parent.close_div('registerDIV');window.parent.open_div('loginDIV')">直接登录</a>
                  </div>
                </div>				    	
		      </form>		      
		</div>
	</div>
	<!-- Modal -->
	<div class="modal fade" id="templatemo_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
	        <h4 class="modal-title" id="myModalLabel">使用协议</h4>
	      </div>
	      <div class="modal-body">
	      	<p>中文中文</p>
		  </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	      </div>
	    </div>
	  </div>
	</div>
	<script type="text/javascript" src="front/js/jquery-1.11.1.min.js"></script>
	<script type="text/javascript" src="front/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="front/js/register.js"></script>
    <script type="text/javascript">
  //发送验证码
//    var time=120;
//    function f1(){
//    	$("#YZcode").val(time+" s后重发");
//    	time--;
//    	if(time<=0){
//    		window.clearInterval();
//    		$("#YZcode").val("验证超时");
//    		
//    	}
//    }
//    function YZcodee(){
//    	$.post("user/sendEMail",{"email":$("#first_name").val()},function(data){
//    		alert(data);
//    	})
//    	window.setInterval("f1()", 1000);
//    	if(time<=0){
//    		window.clearInterval();
//    		$("#YZcode").val("重新获取验证码");
//    		time=120;
//    	}
//    	
//    }
        
      // 注册的方法
    function register(){
        $.ajax({
            url:'../front/user/register',
            data:$("form").serialize(),
            type:'POST',
            dataType:'JSON',
            success:function(data){
                if(data.code=='0000'){
                    alert("注册成功，跳转到登录窗口");
                    $("#mymodal").modal();
                    //注册成功    bootstrap  里面有没有什么弹窗可以用的有  你有时间的改掉这里，这个alert不好看，
                    //TODO:关闭这个登录的iframe  
                    window.parent.close_div('registerDIV');//这个的是在index.jsp 页面里面引用的js的里面的一个方法，这里是跨域调用js方法，
                    //然后跳转到登录吧，
                    window.parent.open_div('loginDIV');
                }else{
                    alert("注册失败,手机号重复");
                    
                }
            }
        });
    }
    
    </script>
</body>
</html>